import { AbstractBloc } from './abstract-bloc';
import { Timer } from 'babylon-lib/misc/timer';
import { PLAYER_BLOC_UPDATE_INTERVAL } from '../../data/data';


class PropertyUpdater {

    private static _block: AbstractBloc;

    public static attach(bloc: AbstractBloc): void {
        this._block = bloc;
        Timer.intervalInSeconds = PLAYER_BLOC_UPDATE_INTERVAL;
        Timer.addIntervalHandle(() => {
            this.stepUpdate();
        });
        Timer.start();
        Timer.pause = true;
    }

    public static set play(isPlay: boolean) {
        Timer.pause = isPlay;
    }

    private static stepUpdate():void{
        console.log("population--",this._block.name,this._block.population)
        /**
         * todo...........
         */
    }

}


export { PropertyUpdater };